package org.testis.gui.mvc.model.testdesign;

import org.testis.gui.mvc.model.*;
import org.testis.gui.mvc.controller.testdesign.ProfileSettingsController;
import org.testis.gui.mvc.utilities.AtofTableModel;



/**
 *
 * @author nurhat
 */
public class ProfileSettingsModel extends AbstractModel
{

    private Boolean m_viewVisibility = false;
    private AtofTableModel m_model;
    private String m_lastError;


    public ProfileSettingsModel(AtofTableModel model)
    {
        super();
        setModel(model);
    }


    public Boolean getViewVisibility()
    {
        return m_viewVisibility;
    }


    public void setViewVisibility(Boolean val)
    {
        boolean oldValue = m_viewVisibility;
        m_viewVisibility = val;

        firePropertyChange(ProfileSettingsController.SHOW_VIEW,
                           oldValue,
                           m_viewVisibility);
    }


    public AtofTableModel getModel()
    {
        if (m_model == null) {
            setModel(new AtofTableModel());
        }
        return m_model;
    }


    public void setModel(AtofTableModel model)
    {
        AtofTableModel oldModel = m_model;
        m_model = model;
        firePropertyChange(
            ProfileSettingsController.PARAMETER_MODEL_CHANGED,
            oldModel,
            m_model);
    }


    public String getLastError()
    {
        return m_lastError;
    }


    public void setLastError(String val)
    {
        String oldValue = m_lastError;
        m_lastError = val;
        firePropertyChange(ProfileSettingsController.SHOW_ERROR,
                           oldValue,
                           m_lastError);
    }
}
